#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
int main()
{
	int a = 0, b = 0, min = 0, i = 0, c = 0;
	//while (scanf("%d %d", &a, &b) != EOF)
	//{
	scanf("%d %d", &a, &b);
		min = a;
		if (min > b)
		{
			min = b;
		}
		for (i = 2; i <= min; i++)
		{
			if (0 == a % i && 0 == b % i)
			{
				c = i;
			}
		}
	//}
	  printf("%d\n", min);
	  return 0;
}